package com.hamster.crmpre.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hamster.crmpre.pojo.Employee;
import com.hamster.crmpre.mapper.EmployeeMapper;
import com.hamster.crmpre.service.EmployeeQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Lizhipeng
 * @date ：Created in 2019/12/25 14:07
 * @description：查询员工信息
 * @modified By：
 * @version:
 */
@Service
public class EmployeeQueryServiceImpl implements EmployeeQueryService {

    @Autowired
    private EmployeeMapper employeeMapper;

    /**
     * 根据部门查询员工信息
     * @param department
     * @return
     */
    @Override
    public List<Employee> listByDepartment(String department) {
        QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("del","0").eq("department",department).orderByDesc("input_time");
        return employeeMapper.selectList(queryWrapper);
    }

    /**
     * 查出所有员工
     * @return
     */
    @Override
    public List<Employee> list() {
        QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
        return employeeMapper.selectList(queryWrapper);
    }
}
